{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="content"}
<div class="t-art" style="margin-bottom:10px;"><a href="/AcpProjectReport/add_project_report" class="btn btn-blue"><i class="gicon-plus white"></i>添加项目申报</a>  </div>
<div class="tablesWrap">  
    <div class="tables-searchbox"> 
	<form name="form1" action="/AcpProjectReport/get_project_report_list" method="get">
        <div class="t-list">
            <span class="tbs-txt">标题：</span>  
            <input type="text" name="title" id="title" value="{$title}">
        </div>
        <div class="t-list t-list-w">
            <div class="formitems inline">
                <label class="fi-name" style="width:40px; font-weight:normal;">时间：</label>
                <div class="form-controls" style="margin-left:40px;">
                    <input type="text" name="begin_time" id="begin_time" value="{$begin_time|date_format:'%Y-%m-%d'}" autocomplete="off" class="Wdate" onclick="WdatePicker({ dateFmt:'yyyy-MM-dd'})">
                    <span class="fi-text">至</span>
                    <input type="text" name="end_time" id="end_time" value="{$end_time|date_format:'%Y-%m-%d'}" autocomplete="off" class="Wdate" onclick="WdatePicker({ dateFmt:'yyyy-MM-dd'})">
                </div>
            </div>
        </div>
        <div class="t-list">
			<input type="hidden" name="act" value="submit" />
            <button class="btn" type="submit"><i class="gicon-search"></i>搜索</button>
        </div>
	</form>
    </div>
    <!-- end tables-searchbox -->
    <table class="wxtables">  
        <colgroup>  
        <col width="5%">  
        <col width="25%">
        <col width="15%">
        <col width="15%">
        <col width="15%">
        <!--<col width="10%">  -->
        <col width="5%">     
        <col width="15%">  
        </colgroup>  
        <thead>  
            <tr>  
                <td>选择</td>  
                <td>标题</td>
                <td>类型</td>
                <td>区域</td>
                <td>添加日期</td>
                <!--<td>浏览量</td> -->
                <td>排序</td>  
                <td>操作</td>  
            </tr>  
        </thead>  
        <tbody>  
		{if $project_report_list}
		{foreach from=$project_report_list item=this}
            <tr>  
                <td class="_checkbox">  
                    <input type="checkbox" class="checkbox" name="a[]" value="{$this.project_report_id}">
                </td>  
                <td>{$this.project_report_name}</td>
                <td>{$this.project_report_type}</td>
                <td>{$this.area_string}</td>
                <!--<td>{$this.article_sort_name}</td>  -->
                <td>{date('Y-m-d H:i:s',$this.addtime)}</td>
                <!--<td>{$this.clickdot}</td>  -->
                <td>{$this.serial}</td>
                <td>  
                    <a href="__APP__/AcpProjectReport/edit_project_report/id/{$this.project_report_id}" class="btn" title="编辑"><i class="gicon-edit black"></i>编辑</a>
                    <a href="javascript:;" onclick="delete_obj({$this.project_report_id});" class="btn" title="删除"><i class="gicon-trash black"></i>删除</a>
                </td>  
            </tr>  
		{/foreach}
		{else}
			<tr>
                <td colspan="7" class="center">暂无项目申报，您可以<a href="__APP__/AcpProjectReport/add_project_report">添加项目申报</a></td>
			</tr>
		{/if}
        </tbody>  
    </table>  
    <!-- end wxtables -->  
	{if $project_report_list}
    <div class="tables-btmctrl clearfix">  
        <div class="fl">  
            <a href="javascript:Select()" class="btn btn-blue">全选</a>
            <a href="javascript:Cancel()" class="btn btn-blue">取消</a>
            <a href="javascript:;" onclick="batch_delete_obj();" class="btn btn-blue">删除</a>
        </div>  
        <div class="fr">  
            <div class="paginate">  
                {$show}
            </div>  
            <!-- end paginate -->  
        </div>  
    </div>  
	{/if}
    <!-- end tables-btmctrl -->  
</div>  
<!-- end tablesWrap -->    
{/block} 

{block name="js"}
<script src="/Public/Plugins/My97DatePicker/WdatePicker.js?version={$version}"></script>
{literal}
<script>
    //全选
    function Select(){
        var sel=document.getElementsByName("a[]");
        for(var i=0;i<sel.length;i++){
            sel[i].checked=true;
        }
    }
    //取消全选
    function Cancel(){
        var sel=document.getElementsByName("a[]");
        for(var i=0;i<sel.length;i++){
            sel[i].checked=false;
        }
    }

    function delete_obj(obj_id)
    {
        $.jPops.confirm(
                {
                    title:"提示",
                    content:"您确定要删除这条数据吗？",
                    okBtnTxt:"确定",
                    cancelBtnTxt:"取消",
                    callback:function(r)
                    {
                        if(r)
                        {
                            $.post('/AcpProjectReport/delete_obj', {"obj_id":obj_id}, function(data, textStatus)
                            {
                                if (data == 'success')
                                {
                                    alert('恭喜您，删除成功！');
                                    location.reload();
                                }
                                else
                                {
                                    alert('对不起，删除失败！');
                                }
                            });
                        }
                        return true;
                    }
                });
    }

    function batch_delete_obj()
    {
        $.jPops.confirm(
                {
                    title:"提示",
                    content:"您确定要删除这些数据吗？",
                    okBtnTxt:"确定",
                    cancelBtnTxt:"取消",
                    callback:function(r)
                    {
                        if(r)
                        {
                            var obj_ids = '';
                            var count = 0;
                            $('input[name="a[]"]:checked').each(function(){
                                count ++;
                                obj_ids += $(this).val() + ',';
                            });

                            if (!count)
                            {
                                alert('对不起，请选择至少一项进行删除！');
                                return;
                            }

                            obj_ids = obj_ids.substr(0, obj_ids.length - 1);

                            $.post('/AcpProjectReport/batch_delete_obj', {"obj_ids":obj_ids}, function(data, textStatus)
                            {
                                if (data == 'success')
                                {
                                    alert('恭喜您，删除成功！');
                                    location.reload();
                                }
                                else
                                {
                                    alert('对不起，删除失败！');
                                }
                            });
                        }
                        return true;
                    }
                });
    }
    </script>
{/literal}
{/block} 
